

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;

namespace DataLayer
{
	public class datEntryContents
	{
		public datEntryContents()
		{
		}
		
		#region  Code Factory Generated Methods
        public void DeleteEntryContentsByEntryContentId(entEntryContents parEntEntryContents, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryContentId", parEntEntryContents.EntryContentId);
            parDbConnector.ExecuteNonQuery("DeleteEntryContentsByEntryContentId", insDbParamCollection);
        }
		public void InsertEntryContents(entEntryContents parEntEntryContents, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pEntryId",parEntEntryContents.EntryId);
			insDbParamCollection.Add("@pLanguageId",parEntEntryContents.LanguageId);
			insDbParamCollection.Add("@pPermalinkGUID",parEntEntryContents.PermalinkGUID);
			insDbParamCollection.Add("@pTitle",parEntEntryContents.Title);
			insDbParamCollection.Add("@pBody",parEntEntryContents.Body);
            insDbParamCollection.Add("@pBodyText", parEntEntryContents.BodyText);
			insDbParamCollection.AddOutput("@pEntryContentId",DbType.Int32);
			parDbConnector.ExecuteNonQuery("InsertEntryContents",insDbParamCollection);
			parEntEntryContents.EntryContentId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
		}

		#endregion
        public DataTable SelectEntryContentsByEntryId(entEntryContents parEntEntryContents, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryId", parEntEntryContents.EntryId);
            return parDbConnector.ExecuteDataTable("SelectEntryContentsByEntryId", insDbParamCollection);
        }
        public void UpdateEntryContentsByEntryContentId(entEntryContents parEntEntryContents, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryContentId", parEntEntryContents.EntryContentId);

            insDbParamCollection.Add("@pEntryId", parEntEntryContents.EntryId);
            insDbParamCollection.Add("@pLanguageId", parEntEntryContents.LanguageId);
            insDbParamCollection.Add("@pTitle", parEntEntryContents.Title);
            insDbParamCollection.Add("@pBody", parEntEntryContents.Body);
            insDbParamCollection.Add("@pBodyText", parEntEntryContents.BodyText);
            parDbConnector.ExecuteNonQuery("UpdateEntryContentsByEntryContentId", insDbParamCollection);
        }
        public void DeleteEntryContentsByEntryId(entEntryContents parEntEntryContents, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryId", parEntEntryContents.EntryId);
            parDbConnector.ExecuteNonQuery("DeleteEntryContentsByEntryId", insDbParamCollection);
        }
        public void SelectEntryContentByPermalinkGUID(entEntryContents parEntEntryContents, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pPermalinkGUID", parEntEntryContents.PermalinkGUID);
            DataTable insDataTable = parDbConnector.ExecuteDataTable("SelectEntryContentByPermalinkGUID", insDbParamCollection);
            if (insDataTable.Rows.Count > 0)
            {
                if (insDataTable.Rows[0]["EntryContentId"] != DBNull.Value)
                {
                    parEntEntryContents.EntryContentId = Convert.ToInt32(insDataTable.Rows[0]["EntryContentId"]);
                }
                if (insDataTable.Rows[0]["EntryId"] != DBNull.Value)
                {
                    parEntEntryContents.EntryId = Convert.ToInt32(insDataTable.Rows[0]["EntryId"]);
                }
                if (insDataTable.Rows[0]["LanguageId"] != DBNull.Value)
                {
                    parEntEntryContents.LanguageId = Convert.ToInt32(insDataTable.Rows[0]["LanguageId"]);
                }
                if (insDataTable.Rows[0]["PermalinkGUID"] != DBNull.Value)
                {
                    parEntEntryContents.PermalinkGUID = new Guid(insDataTable.Rows[0]["PermalinkGUID"].ToString());
                }
                if (insDataTable.Rows[0]["Title"] != DBNull.Value)
                {
                    parEntEntryContents.Title = insDataTable.Rows[0]["Title"].ToString();
                }
                if (insDataTable.Rows[0]["Body"] != DBNull.Value)
                {
                    parEntEntryContents.Body = insDataTable.Rows[0]["Body"].ToString();
                }
                if (insDataTable.Rows[0]["BodyText"] != DBNull.Value)
                {
                    parEntEntryContents.BodyText = insDataTable.Rows[0]["BodyText"].ToString();
                }
            }
        }
        public void SelectEntryContentsByEntryContentId(entEntryContents parEntEntryContents, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryContentId", parEntEntryContents.EntryContentId);
            DataTable insDataTable = parDbConnector.ExecuteDataTable("SelectEntryContentsByEntryContentId", insDbParamCollection);
            if (insDataTable.Rows.Count > 0)
            {
                if (insDataTable.Rows[0]["EntryContentId"] != DBNull.Value)
                {
                    parEntEntryContents.EntryContentId = Convert.ToInt32(insDataTable.Rows[0]["EntryContentId"]);
                }
                if (insDataTable.Rows[0]["EntryId"] != DBNull.Value)
                {
                    parEntEntryContents.EntryId = Convert.ToInt32(insDataTable.Rows[0]["EntryId"]);
                }
                if (insDataTable.Rows[0]["LanguageId"] != DBNull.Value)
                {
                    parEntEntryContents.LanguageId = Convert.ToInt32(insDataTable.Rows[0]["LanguageId"]);
                }
                if (insDataTable.Rows[0]["PermalinkGUID"] != DBNull.Value)
                {
                    parEntEntryContents.PermalinkGUID = new Guid(insDataTable.Rows[0]["PermalinkGUID"].ToString());
                }
                if (insDataTable.Rows[0]["Title"] != DBNull.Value)
                {
                    parEntEntryContents.Title = insDataTable.Rows[0]["Title"].ToString();
                }
                if (insDataTable.Rows[0]["Body"] != DBNull.Value)
                {
                    parEntEntryContents.Body = insDataTable.Rows[0]["Body"].ToString();
                }
                if (insDataTable.Rows[0]["BodyText"] != DBNull.Value)
                {
                    parEntEntryContents.BodyText = insDataTable.Rows[0]["BodyText"].ToString();
                }
            }
        }
	}
}